package com.hdf.etdemo.view.text;

import com.hdf.easytools.base.EasyToolsActivity;
import com.hdf.easytools.view.text.QuantityView;
import com.hdf.etdemo.R;
import com.hdf.etdemo.R.id;
import com.hdf.etdemo.R.layout;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

public class TextViewActivity extends EasyToolsActivity implements QuantityView.OnQuantityChangeListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_text_view);
		/** 设置标题显示 */
		this.TitleVisib(0, 1, 1, 0, 0);
		/** 绑定标题点击事件 */
		this.TitleClick(0, 1, 0, 0, 0);
		/** 设置标题样式ʽ */
		this.TitleStyle(null, R.drawable.et_back, "增加减少文本框", null, 0);
		QuantityView quantityViewDefault = (QuantityView) findViewById(R.id.quantityView_default);
		quantityViewDefault.setOnQuantityChangeListener(this);

		QuantityView quantityViewCustom1 = (QuantityView) findViewById(R.id.quantityView_custom_1);
		quantityViewCustom1.setOnQuantityChangeListener(this);

		QuantityView quantityViewCustom2 = (QuantityView) findViewById(R.id.quantityView_custom_2);
		quantityViewCustom2.setOnQuantityChangeListener(this);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.left_img:
			finish();
			break;

		default:
			break;
		}
	}

	@Override
	public void onQuantityChanged(int newQuantity, boolean programmatically) {
		// TODO Auto-generated method stub
		Toast.makeText(TextViewActivity.this, "Quantity: " + newQuantity, Toast.LENGTH_LONG).show();
	}

	@Override
	public void onLimitReached() {
		// TODO Auto-generated method stub
		Log.d(getClass().getSimpleName(), "Limit reached");
	}

}
